/* ---------- 全局变量系统 ---------- */
:root {
  /* 颜色 */
  --color-bg: #d8d8d8;
  --color-text: #202020;
  --color-accent: #2b0000;
  --color-button-bg: #202020;
  --color-button-text: #d8d8d8;
  --color-hover:#4c4c4c;
  --color-white: #f0f0f0;

  /* 字体 */
  --font-title: 'Source Han Sans','Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --font-body: 'Source Han Sans','Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Heiti SC', sans-serif;

  /* 字号 */
  --fz-h1: 2.8rem;
  --fz-h2: 1.5rem;
  --fz-body: 1.125rem;
  --fz-button: 1rem;
  --fz-label: 0.95rem;
  --fz-large: 24px;
  --fz-medium: 16px;
  --fz-small: 14px;

  /* 字重 */
  --fw-light: 400;
  --fw-regular: 450;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* 层级 */
  --z-base: 0;
  --z-game: 10;
  --z-overlay: 90;
  --z-modal: 100;
  --z-blindbox: 150;
  --z-notification: 200;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 24px;
  --space-xl: 48px;

  /* 动画节奏 */
  --ease-fast: 0.15s ease-out;
  --ease-normal: 0.25s ease-in-out;
  --ease-slow: 0.45s ease-in;

  /* 边框与阴影统一 */
  --border-color: #202020;
  --border-width: 1px;
  --border-radius: 2px;
  --btn-radius: 2px;
  --shadow: 0 4px 15px #4c4c4c;
}

html, body { height: 100%; }

body {
  background: #202020;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 固定画布（1000×600） */
.game-frame {
  width: 1000px;
  height: 600px;
  background: transparent;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
}

/* =========================================================
   基础文本设定
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-weight: var(--fw-regular);
  font-size: var(--fz-body);
  line-height: 1.2;
  letter-spacing: 0.4px;
}
.hidden { display: none !important; }
.visible { display: block !important; }

.sakiko-text { color: #7799CC;}
.mutsumi-text { color: #779977;}

@font-face {
  font-family: 'Source Han Sans';
  src: url('./Fonts/SourceHanSansCN-Bold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: swap; /* 优化加载显示 */
}

@font-face {
  font-family: 'Source Han Sans';
  src: url('./Fonts/SourceHanSansCN-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap; /* 优化加载显示 */
}
/* =========================================================
   1. 主菜单（Main Menu）
   ========================================================= */
#mainMenu {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--color-bg);
  color: var(--color-text);
  text-align: center;
  z-index: var(--z-base); 
}

.modal-menu {
  position: absolute;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
  height: 520px; /* 与 #saveMenu 一致 */
  width :100%;
  max-width: 712px;
  min-height: 344px;
  max-height: 530px;
  z-index: var(--z-modal);
  display:flex;
  flex-direction:column;
  background: transparent;
  font-family: 'Source Han Sans';
  overflow: hidden;
}

.main-visual-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1000px;
  max-height: 600px;
  margin: auto;
  overflow: hidden;
}

.main-visual-img {
  width: 100%;
  height: 110%;
  object-fit: cover; 
  display: block;
  filter: grayscale(100%) contrast(120%) brightness(85%);
}

.menu-content {
  position: absolute;
  top: 45%;
  right: 5%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: none;
  border: none;
  box-shadow: none;
  z-index: 3;
}

.menu-content h1 {
  font-family: 'Source Han Sans';
  font-size: var(--fz-h1);
  font-weight: var(--fw-bold);
  background:linear-gradient(180deg, #000000 28%, #ED0000 100%);
  letter-spacing: 1.2px;
  line-height: 1.3;
  text-align: center;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color:transparent;
  -webkit-text-stroke: var(--color-bg);
}

.menu-content p {
  font-family: 'Source Han Sans';
  font-size: 1.25rem;
  font-weight: var(--fw-bold);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  letter-spacing: 0.6px;
  text-align: center;
  margin-bottom: 10px;
  text-shadow:
    1px 0 0 var(--color-bg),
   -1px 0 0 var(--color-bg),
    0 1px 0 var(--color-bg),
    0 -1px 0 var(--color-bg),
    1px 1px 0 var(--color-bg),
   -1px -1px 0 var(--color-bg),
    1px -1px 0 var(--color-bg),
   -1px 1px 0 var(--color-bg);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.menu-btn {
  padding: 15px 50px;
  background: var(--color-bg);
  color: var(--color-text);
  border: 2px solid var(--color-button-bg);
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: var(--fz-h2);
  font-weight: var(--fw-semibold);
  transition: background var(--ease-normal), transform var(--ease-normal);
  text-align: center;
}
.menu-btn:hover {
  background: var(--color-button-bg);
  color: var(--color-button-text);
  transform: translateY(-2px);
}
.menu-btn:active {
  background: var(--color-accent);
  transform: translateY(0);
  opacity: 0.9;
}

/* =========================================================
   2. 游戏主容器（#gameContainer 保留，放在 .game-frame 内）
   ========================================================= */
#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  z-index: var(--z-game);
  background: linear-gradient(180deg, #FFFFFF 0%, #4C4C4C 99%);
  padding-top: 18px;
  padding-left: 41px;
  padding-right: 41px;
}

/* 标题区域 */
header, .header {
  padding: 12px;
  text-align: center;
  background: transparent;
  border-bottom: none;
}

/* 日期/时间显示（居中） */
.dayTime-display {  
  /* 布局 */
  margin-bottom: 16px;  /* 添加与main container的间距 */
  /* 标题字体 */
  font-family: 'Source Han Sans';
  font-size: 24px;
  font-weight: bold;
  line-height: normal;
  letter-spacing: -1px;

  /* 文字水平居中 */
  text-align: center;

  /* 文字垂直居中 */
  display: flex;
  align-items: center; /* 垂直居中 */
  justify-content: center; /* 水平居中 */
}

/* 主体两栏布局（左：状态；右：剧情） */
.main-content {
  /* 布局 */
  display: flex;
  align-items: stretch;
  
  /* 尺寸与间距 */
  height: 504px; /* header & margins */
  /* margin-top: 16px; */
  gap: 16px;
  
  /* 外观 */
  overflow: hidden;
}

/* =========================================================
   左右面板基础布局
   ========================================================= */
/* 左侧：固定尺寸 */
.left-panel {
  /* 布局 */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  
  /* 尺寸 */
  width: 170px;
  flex: 0 0 170px;
  
  /* 间距 */
  padding: 1px;
  gap: 2px;
  
  /* 外观 */
  background: none;
  border: none;
  box-shadow: none;
}

/* 右侧：自适应剩余空间 */
.right-panel {
  /* 布局 */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  box-sizing: border-box;
  
  /* 尺寸 */
  flex: 1;

  /* 外观 */
  background: none;
  border: none;
  box-shadow: none;
}

/* =========================================================
   左上：状态面 / 数值条（占左侧三分之二） 2.1
   ========================================================= */
.stats-panel {
  /* 布局属性 */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-bottom: 16px;

  /* 尺寸属性 */
  width: 100%;
  height: 344px;
  flex: 0 0 344px;                   /* 固定高度 */

  /* 间距属性 */
  gap: 18px;
  padding-top: 16px;
  padding-left: 18px;
  padding-right: 18px;

  /* 外观属性 */
  background: var(--color-white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);

  /* 其他属性 */
  overflow-y: auto;
  box-sizing: border-box;
}

/* 数值条容器 */
.stat {
  /* 布局属性 */
  display: flex;
  flex-direction: column;

  /* 间距属性 */
  gap: 5px;
}

/* 数值条标题行（标签 + 数值）*/
.stat-header {
  /* 布局属性 */
  display: flex;
  align-items: center;

  /* 间距属性 */
  gap: 5px;
}

/* 数值条文字样式（标签、数值、标签内的span）*/
.stat-label,
.stat-value,
.stat-label span {
  /* 文字属性 */
  font-size: var(--fz-small);
  text-align: left;
}

/* 进度条 */
.bar-container {
  width: 100%;
  height: 12px;
  background: var(--color-bg);
  border: 1.5px solid var(--border-color);
  overflow: hidden;
}
.bar {
  height: 100%;
  border-radius: var(--border-radius);
  transition: width 0.5s ease;
}

/* 颜色样例 */
#staminaBar { background: linear-gradient(to right, #5ed4da, #2a8f95); }
#sakikoMoodBar { background: linear-gradient(to right, #a2b3e8, #5a6fb3); }
#mutsumiMoodBar { background: linear-gradient(to right, #a2bfa2, #566a56); }
#infectionBar { background: linear-gradient(to right, #ff7a7a, #b30000); }
#suppliesBar { background: linear-gradient(to right, #ffe066, #e68a00); }
#loveBar { background: linear-gradient(to right, #ff8c8c, #a32636); }

/* =========================================================
   左下：存档按钮组（占左侧三分之一） 2.2
   ========================================================= */
.save-load-buttons {
  flex: 0 0 29%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 9px;
  background: none;
  border: 1px;
  box-shadow: none;
  width: 100%;
  box-sizing: border-box;
  transform: translateY(-6px); 
}
.save-load-buttons button {
  /* 布局属性 */
  text-align: left;

  /* 尺寸属性 */
  width: 100%;
  height: 42px;

  /* 间距属性 */
  padding-left: 18px; /* 文字距离左边18px */

  /* 文字属性 */
  font-size: var(--fz-small);
  font-weight: bold;
  color: var(--color-text);

  /* 外观属性 */
  background: #E1E1E1;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);

  /* 交互属性 */
  cursor: pointer;
  transition: background var(--ease-normal), transform var(--ease-normal);
}
.save-load-buttons button:hover {
  background: var(--color-hover);
  transform: translateY(-2px);
}

/* =========================================================
   右上：故事区（占右侧三分之二） 2.3
   ========================================================= */
.story-container {
  height: 344px;
  flex: 0 0 344px;                  /* 占右栏上三分之二 */
  padding-top: 18px;
  padding-left: 18px;
  background: var(--color-white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  overflow-y: auto;
  margin-bottom: 16px;

  line-height: 1.75;
  font-size: var(--fz-medium);
  font-weight: var(--fw-regular);
  color: var(--color-text);
  text-align: left;
  box-sizing: border-box;
}

.story-container span {
  font-size: var(--fz-medium);
}

/* 对话中角色回应样式 */
.story-container .response-text {
  color: #115342;
  margin-top: 20px;
  font-size: var(--fz-medium);
  font-weight: bold;
  text-align: left;
}

/* =========================================================
   右下：动作选项区（占右侧三分之一）2.4
   ========================================================= */
.actions-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  background: none;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
  justify-items: stretch;
  align-items: stretch;
}

.action-btn {
  height: 68px;
  background: var(--color-button-bg);
  color: var(--color-button-text);
  border: none;
  border-radius: var(--btn-radius);
  font-size: var(--fz-small);
  font-weight: var(--fw-medium);
  text-align: left;
  line-height: 1.5;
  padding-left: 18px; /* 文字距离左边18px */
  cursor: pointer;
  transition: background var(--ease-normal), transform var(--ease-normal);
}

.desc-text {
  font-size: 0.75rem;    
  font-weight: var(--fw-light);  
  opacity: 0.85;       
}

.action-btn:hover {
  background: var(--color-accent);
  transform: translateY(-2px);
}
.action-btn:disabled {
  background: #4c4c4c;
  cursor: not-allowed;
  transform: none;
}

.action-btn .action-label {
  font-size: var(--fz-small);
  font-weight: var(--fw-bold);
  line-height: 1.5;
}

.action-btn .action-desc {
  font-size: var(--fz-small);
  font-weight: var(--fw-regular);
  line-height: 1.5;
}
/* ========================================================= 
  3. 存档菜单（SaveMenu）
  ========================================================= */

#saveMenu {
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  box-shadow: var(--shadow);
  max-width: 712px;
  max-height: 520px;
  width: 100%;
  height: 100%;
  text-align: center;
}

/* ================= 内部内容 ================= */

.save-menu-content {
  background: linear-gradient(180deg, #FFFFFF 0%, #4C4C4C 99%);
  border-radius: 4px;
  padding: 30px;
  font-family: "Source Han Sans";
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  align-items: center; /* 添加这行让子元素水平居中 */
}

.save-menu-content h2 {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  text-align: center;
  padding-bottom: 10px;
}


/* ================= 存档槽容器 ================= */

#saveSlots {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* 重要：允许内容缩小 */
  overflow-y: auto;
  margin-bottom: 10px;
}

/* ================= 单个存档槽 ================= */

.save-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding: 10px;
  border-radius: 4px;
  background: var(--color-white);
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--shadow);
  font-size: var(--fz-medium);
  font-weight: var(--fw-medium);
}

.save-slot-info {
  flex: 1; /* 占据剩余空间，将按钮推到右侧 */
  margin-right: 15px; /* 与按钮保持间距 */
}

.slot-actions {
  width: 300px;
  justify-content: space-between;
  display: flex;
  gap: 8px; /* 按钮之间的间距 */
  flex-shrink: 0; /* 防止按钮被压缩 */
}

/* ================= 按钮样式 ================= */

.saveSlotsBtn{
  color: var(--color-button-text);
  background: var(--color-button-bg);
  padding: 5px 12px;
  white-space: nowrap;
}

#saveMenu .save-slot .slot-actions button,
#saveMenu .save-menu-content > button {
  padding: 10px 20px;
  border: var(--border-radius);
  border-radius: 4px;
  background: var(--color-button-bg);
  color: var(--color-button-text);
  font-size: var(--fz-button);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

#saveMenuBack {
  width: 100px;
}

#saveMenu .save-slot .slot-actions button:hover,
#saveMenu .save-menu-content > button:hover {
  transform: translateY(-3px);
  background: var(--color-accent);
}


/* =========================================================
   4. 模态（modal）序章，数值，教程，结局
   ========================================================= */
.modal {
  position: absolute;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
  height: auto;
  width :100%;
  max-width: 712px;
  min-height: 344px;
  max-height: 530px;
  z-index: var(--z-modal);
  display:flex;
  flex-direction:column;
  background: transparent;
  font-family: 'Source Han Sans';
}

.btn-area {
  background-color: var(--color-white);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0 0 4px 4px;   /* 只保留下圆角 */
  padding: 10px;
  margin-top: -1%; /* 负间距 */
}

.modal-content {
  color: var(--color-text);
  text-align: left;
  flex: 1 1 auto;
  overflow-y: auto; 
  padding: 30px;
  background: var(--color-white);  
  margin: 0;
  border-radius: 4px 4px 0 0;  /* 只保留上圆角 */
  margin-bottom: 0; /* 不要间距 */
}

.modal h2 {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  text-align: center;
  padding-bottom: 10px;
}

.modal p {
  padding-top: 10px;
  margin-bottom: 15px;
  text-align: left;
  line-height: 1.75;
  font-size: var(--fz-body);
  font-weight: var(--fw-regular);
  transition: opacity 1s ease;
}

.modal-btn {
  display: flex;
  background: var(--color-button-bg);
  color: var(--color-button-text);
  cursor: pointer;
  transition: all var(--ease-normal);
  padding: 10px 70px ;
  font-size: var(--fz-medium);
  justify-content: center;
  margin: 1%;
  border: var(--color-white);
  border-radius: var(--btn-radius);
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px #4c4c4c;
  background: var(--color-accent);
}

/* 教程点 */
.tutorial-steps {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
  padding-top: 10px;
}

.tutorial-step {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: #4c4c4c;
}

.tutorial-step.active {
  background: var(--color-text);
}

/* ending modal */

#endingModal .modal-content { 
  color: var(--color-text);
  text-align: left;
  flex: 1 1 auto;
  overflow-y: auto; 
  padding: 30px;
  background: var(--color-white);  
  margin: 0;
  border-radius: 4px 4px 0 0;  /* 只保留上圆角 */
  margin-bottom: 0; /* 不要间距 */
}

#endingTitle { 
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  text-align: center;
  padding-bottom: 20px;
 }

#endingText { 
  padding-top: 10px;
  margin-bottom: 15px;
  text-align: left;
  line-height: 2.2;
  font-size: var(--fz-body);
  font-weight: var(--fw-regular);
  transition: opacity 1s ease;
}


/* =========================================================
   5. 对话弹窗（dialog-popup）详细样式
   ========================================================= */
.dialog-popup {
  position: absolute;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
  height: auto;
  width :100%;
  max-width: 712px;
  max-height: 530px;
  z-index: var(--z-modal);
  display:flex;
  flex-direction:column;
  background: var(--color-white);
  font-family: 'Source Han Sans';
  color: var(--color-text);
  text-align: left;
  overflow-y: visible; 
  padding: 30px; 
  border-radius: 4px; 
}

.dialog-popup h2 {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  text-align: center;
  padding-bottom: 10px;
}

.dialog-content {
  padding-top: 10px;
  margin-bottom: 15px;
  text-align: left;
  line-height: 2.0;
  font-size: var(--fz-body);
  font-weight: var(--fw-regular);
  transition: opacity 1s ease;
  overflow-y: auto;
}

.dialog-options {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.dialog-btn {
  margin-top: 10px;
  padding: 15px 10px;
  border: none;
  border-radius: 4px;
  background: var(--color-button-bg);
  color: var(--color-button-text);
  font-size: var(--fz-medium);
  cursor: pointer;
  width: 100%;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.dialog-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px #4c4c4c;
  background: var(--color-accent);
}

/* =========================================================
   6. 插图（action-image）与盲盒（blindBoxModal）
   ========================================================= */
.action-image { 
  position:absolute;
  top:105px;
  right: 76px;
  opacity:0;
  transition: opacity 0.25s ease-in-out;
  z-index:var(--z-blindbox);
  display: block !important;
}
.action-image.visible { opacity:1; }

.action-image img { 
  max-width: 400px; 
  max-height:250px; 
  width:auto; 
  height:auto; 
  box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.3);
}

/* gentleShake */
@keyframes gentleShake {
  0%   { transform: translate(-50%, -50%) rotate(0deg) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  25%  { transform: translate(-52%, -50%) rotate(-3deg); }
  50%  { transform: translate(-48%, -50%) rotate(3deg); }
  75%  { transform: translate(-52%, -50%) rotate(-3deg); }
  90%  { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(0deg) scale(0.9); opacity: 0; }
}

/* ===Blind Box Modal === */
#blindBoxModal .modal-content {
  background: var(--color-white);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 35px 30px;
  max-height: 400px;
  max-width: 570px;
  margin-left: 10%;
  margin-top: 10%;
  width: 100%;
  height: 100%;
  border: 2px solid var(--border-color);
  color: var(--color-white);
  font-family: "Source Han Sans";
  text-align: center
}

/* === Title === */
#blindBoxTitle {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  margin-bottom: 10px;
  color: var(--color-text);
  letter-spacing: 2px;
  text-shadow: 0 0 2px var(--color-white);
}

#blindBoxMessage {
  font-size: 1rem;
  font-weight: var(--fw-semibold);
  text-align: center;
  color: var(--color-text);
  letter-spacing: 2px;
  text-shadow: 0 0 2px var(--color-white);
}

/* === Image / Hint Area === */
#blindBoxImageArea {
  min-height: 50px;
  margin-bottom: 10px;
  color: var(--color-hover);
  font-style: italic;
}

/* === Options Container === */
#blindBoxOptions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* === Blind Box Item === */
.blind-box {
  width: 60px;
  height: 60px;
  background: linear-gradient(180deg, #5C5C5C 0%, #040404 100%);
  border: 2px solid #4c4c4c;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.blind-box:hover {
  transform: scale(1.05);
  border-color: white;
  box-shadow: 0 0 15px rgba(200,255,255,0.4);
}

/* 轻微摇动动画 */
.blind-box.shaking {
  animation: gentleShake 0.4s ease-in-out 1;
}

/* === Result === */
#blindBoxResult {
  margin-top: 10px;
  animation: fadeIn 0.6s ease;
}

#blindBoxResultText {
  font-size: 1rem;
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: 10px;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 0 4px rgba(255,255,255,0.3);
}

/* === Buttons === */
#closeBlindBoxBtn,
#openBlindBoxBtn {
  background: var(--color-button-bg);
  border-radius: 8px;
  padding: 5px 15px;
  color: var(--color-white);
  cursor: pointer;
  transition: all 0.2s ease;
  display: block;
  margin: 0 auto
}

#closeBlindBoxBtn:hover,
#openBlindBoxBtn:hover {
  background: #000;
}

/* === Animations === */
@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =======================================================
   7. 通知（右下）与遮罩
   ========================================================= */
.notification {
  position: fixed;
  bottom: var(--space-sm);
  right: var(--space-sm);
  max-width: 300px;
  padding: var(--space-sm);
  border-radius: 4px;
  border-left: 5px solid var(--color-accent);
  background: var(--color-white);
  color: var(--color-text);
  box-shadow: var(--shadow);
  z-index: var(--z-notification);
  transform: translateX(100%);
  opacity: 0;
  transition: transform var(--ease-slow), opacity var(--ease-normal);
  text-align: left;
}
.notification.show { transform: translateX(0); opacity: 1; }

/* =========================================================
   8. 遮掩层
   ========================================================= */
.overlay { 
  position: fixed; 
  inset:0; 
  background: var(--border-color); 
  z-index: var(--z-overlay); }

/* ---------- 响应式设计 ---------- */

/* 平板设备 (768px - 1024px) */
@media screen and (max-width: 1024px) and (min-width: 768px) {
  body {
    padding: 10px;
    overflow: auto;
  }
  
  .game-frame {
    width: 95vw;
    height: 95vh;
    max-width: 900px;
    max-height: 540px;
    transform: scale(0.95);
  }
  
  #gameContainer {
    padding: 12px;
  }
  
  .main-content {
    height: calc(100% - 80px);
    gap: 12px;
  }
  
  .stats-panel {
    height: 280px;
    flex: 0 0 280px;
    padding: 12px;
    gap: 12px;
  }
  
  .story-container {
    height: 280px;
    flex: 0 0 280px;
    padding: 12px;
  }
  
  .save-load-buttons {
    gap: 6px;
  }
  
  .save-load-buttons button {
    height: 36px;
    font-size: 0.85rem;
  }
  
  .actions-container {
    gap: 6px 8px;
  }
  
  .action-btn {
    height: 60px;
    padding-left: 12px;
    font-size: 0.85rem;
  }
  
  .dayTime-display {
    font-size: 1.2rem;
    margin-bottom: 12px;
  }
}

/* 大屏手机 (480px - 767px) */
@media screen and (max-width: 767px) and (min-width: 480px) {
  body {
    padding: 5px;
    overflow: auto;
    align-items: flex-start;
  }
  
  .game-frame {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border: none;
    border-radius: 0;
  }
  
  #gameContainer {
    padding: 8px;
    padding-top: 10px;
  }
  
  /* 改为单栏布局 */
  .main-content {
    flex-direction: column;
    height: auto;
    gap: 8px;
  }
  
  .left-panel {
    width: 100%;
    flex: none;
    order: 2; /* 状态栏放到下面 */
  }
  
  .right-panel {
    flex: none;
    order: 1; /* 故事区放到上面 */
  }
  
  .stats-panel {
    height: auto;
    flex: none;
    padding: 10px;
    gap: 10px;
    margin-bottom: 8px;
  }
  
  .story-container {
    height: 200px;
    flex: none;
    padding: 10px;
    margin-bottom: 8px;
  }
  
  .save-load-buttons {
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
    transform: none;
  }
  
  .save-load-buttons button {
    flex: 1;
    height: 32px;
    font-size: 0.8rem;
    padding-left: 8px;
  }
  
  .actions-container {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .action-btn {
    height: 50px;
    padding-left: 10px;
    font-size: 0.8rem;
  }
  
  .dayTime-display {
    font-size: 1rem;
    margin-bottom: 8px;
  }
  
  /* 模态框调整 */
  .modal, .dialog-popup {
    width: 95vw;
    max-width: none;
    max-height: 80vh;
  }
  
  .modal-content, .dialog-popup {
    padding: 20px;
  }
  
  /* 主菜单调整 */
  .menu-content {
    right: 2%;
    top: 40%;
  }
  
  .menu-content h1 {
    font-size: 2rem;
  }
  
  .menu-content p {
    font-size: 1rem;
  }
  
  .menu-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
  }
}

/* 小屏手机 (小于480px) */
@media screen and (max-width: 479px) {
  body {
    padding: 0;
  }
  
  .game-frame {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
  }
  
  #gameContainer {
    padding: 6px;
    padding-top: 8px;
  }
  
  .main-content {
    gap: 6px;
  }
  
  .stats-panel {
    padding: 8px;
    gap: 8px;
    margin-bottom: 6px;
  }
  
  .stat-label,
  .stat-value,
  .stat-label span {
    font-size: 0.75rem;
  }
  
  .bar-container {
    height: 10px;
  }
  
  .story-container {
    height: 180px;
    padding: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
  }
  
  .story-container span {
    font-size: 0.9rem;
  }
  
  .save-load-buttons {
    gap: 6px;
  }
  
  .save-load-buttons button {
    height: 28px;
    font-size: 0.75rem;
    padding-left: 6px;
  }
  
  .actions-container {
    gap: 4px;
  }
  
  .action-btn {
    height: 45px;
    padding-left: 8px;
    font-size: 0.75rem;
  }
  
  .dayTime-display {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }
  
  /* 模态框进一步调整 */
  .modal, .dialog-popup {
    width: 98vw;
    max-height: 85vh;
  }
  
  .modal-content, .dialog-popup {
    padding: 15px;
  }
  
  .modal h2, .dialog-popup h2 {
    font-size: 1.2rem;
  }
  
  .modal p, .dialog-content {
    font-size: 0.9rem;
    line-height: 1.6;
  }
  
  .modal-btn, .dialog-btn {
    padding: 8px 20px;
    font-size: 0.9rem;
  }
  
  /* 主菜单移动端优化 */
  .menu-content {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    width: 90%;
    margin: 0 auto;
    padding-top: 20px;
  }
  
  .menu-content h1 {
    font-size: 1.8rem;
    -webkit-text-stroke: 0.5px var(--color-bg);
  }
  
  .menu-content p {
    font-size: 0.9rem;
  }
  
  .menu-buttons {
    width: 100%;
  }
  
  .menu-btn {
    width: 100%;
    padding: 10px 20px;
    font-size: 1rem;
  }
  
  /* 插图调整 */
  .action-image {
    top: 80px;
    right: 20px;
    max-width: 200px;
  }
  
  .action-image img {
    max-width: 200px;
    max-height: 150px;
  }
}

/* 横屏手机特殊处理 */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .game-frame {
    height: 100vh;
  }
  
  #gameContainer {
    padding: 4px;
  }
  
  .main-content {
    height: calc(100vh - 60px);
  }
  
  .stats-panel,
  .story-container {
    height: 100%;
    flex: 1;
  }
  
  .save-load-buttons {
    flex-direction: row;
    flex: none;
    height: auto;
  }
  
  .save-load-buttons button {
    height: 30px;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .game-frame {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* 防止文字过小 */
@media screen and (max-width: 359px) {
  :root {
    --fz-small: 12px;
    --fz-medium: 14px;
    --fz-body: 14px;
  }
  
  .stats-panel,
  .story-container,
  .action-btn,
  .save-load-buttons button {
    font-size: 12px;
  }
}